package org.easyway.tiles.generic;

import java.awt.Graphics;
import java.awt.Image;
import java.awt.Rectangle;

import javax.swing.JPanel;

public class CurrentJPanel extends JPanel {

	private static final long serialVersionUID = 362712829818195667L;

	public CustomImage cimg;

	public Image image;

	public CurrentJPanel(CustomImage cimg) {
		this.cimg = cimg;
		this.setBounds(new Rectangle(863, 17, 64, 64));
	}

	public void paint(Graphics g) {
		if (image != null) {
			g.drawImage(image, 0, 0, this.getWidth(), this.getHeight(), null);
		} else if (cimg != null && cimg.img != null)
			g.drawImage(cimg.img, 0, 0, getWidth(), getHeight(), null);
		else {
			g.clearRect(0, 0, this.getWidth(), this.getHeight());
			g.drawString("BLANK", 1, 16);
		}
	}
}
